package io.laputa.offer.service.impl;

import com.auth0.jwt.exceptions.JWTVerificationException;
import io.laputa.offer.dao.UserDAO;
import io.laputa.offer.entity.User;
import io.laputa.offer.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Qsh
 * @since 2024/9/14
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDAO userDAO;

    @Override
    public User login(User user) {
        User userDB = userDAO.login(user);
        if (userDB != null) return userDB;
        throw new JWTVerificationException("登录失败");
    }
}
